package com.yao.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yao.po.Users;
import com.yao.mapper.UsersMapper;
import com.yao.service.IUsersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户信息表 服务实现类
 * </p>
 *
 * @author author
 * @since 2024-12-21
 */
@Service
public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements IUsersService {

    private  final UsersMapper  usersMapper;

    public UsersServiceImpl(UsersMapper usersMapper) {
        this.usersMapper = usersMapper;
    }

    @Override
    public void setUserInfo(Users userInfoVo) {
        LambdaUpdateWrapper<Users> updateWrapper = new LambdaUpdateWrapper<>();
        LambdaUpdateWrapper<Users> set = updateWrapper.eq(Users::getOpenId, userInfoVo.getOpenId())
                .set(Users::getUsername, userInfoVo.getUsername());
//                .set(Users::getImageUrl, userInfoVo.getImageUrl());
        usersMapper.update(set);
    }
}
